class daocheng::wn {
  #$condor_pkg = [
  #    "condor-9.0.4-1.el7.x86_64",
  #    "condor-classads-9.0.4-1.el7.x86_64",
  #    "condor-kbdd-9.0.4-1.el7.x86_64",
  #    "condor-procd-9.0.4-1.el7.x86_64",
  #    "condor-externals-9.0.4-1.el7.x86_64",
  #    "python2-condor-9.0.4-1.el7.x86_64",
  #    "python3-condor"
  #]

    $condor_pkg = [
      "condor",
      "condor-classads",
      "condor-kbdd",
      "condor-procd",
      "condor-externals",
      "python3-condor",
      "python3-scitokens",
    ]
    yumrepo { "condor":
      baseurl => "http://${mirrorserver}/yum/condor/repo/10.x/el${facts['os']['release']['major']}/x86_64/release",
      descr => "condor",
      enabled => 1,
      gpgcheck => 0,
      priority => 20,
      before   => Yumrepo['site'],
    }->


  package { $condor_pkg:
              ensure  => installed,
              require => Yumrepo['site'],
  } -> 
  package {"condor-worker":
    ensure     => absent,
  } ->
  file {"/etc/condor/wrapper":
    ensure     =>  directory,
    mode       =>  '0755',
    owner      =>  'root',
    group      =>  'root',
  } ->
  file {"/etc/condor/wrapper/wrapper.sh":
    mode       =>  '0755',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/wrapper.sh",
  } ~>
  file {"/etc/condor/config.d/worker.conf":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/worker.conf",
    notify     =>  Exec['refreshcondorwn']
  } ~>
  service { 'condor':
    ensure     => 'running',
    enable     => true,
    hasrestart => true,
    hasstatus  => true,
  } 
  exec {'refreshcondorwn':
    command      => "/usr/sbin/condor_reconfig",
    refreshonly  => true
  }
}
